package sys.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sys.core.ResponseResult;
import sys.core.annotation.LoginRequired;
import sys.core.annotation.RecordLog;
import sys.entity.PageData;
import sys.entity.TbUserEntity;
import sys.entity.TeacherEntity;
import sys.service.TeacherService;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/teacher")
@Api(tags = "教师管理")
public class TeacherController {


    @Autowired
    private TeacherService teacherService;


    /**
     * 查询
     *
     * @return
     */
    @ApiOperation(value = "查询")
    @LoginRequired
    @RecordLog
    @PostMapping(value = "/select")
    public List<TeacherEntity> select(@RequestBody TeacherEntity TeacherEntity) {
        return teacherService.select(TeacherEntity);
    }


    /* *//**
     * 查询
     *
     * @return
     *//*
    @ApiOperation(value = "查询")
    @LoginRequired
    @RecordLog
    @PostMapping(value = "/getTeacher")
    public List<TeacherEntity> getTeacher() {
        return teacherService.select(null);
    }*/


    /**
     * X
     * 模糊查询
     *
     * @returnW
     */
    @ApiOperation(value = "模糊查询")
    @LoginRequired
    @RecordLog
    @PostMapping(value = "/likeSelect")
    public PageData<TeacherEntity> likeSelect(@RequestBody TeacherEntity TeacherEntity) {
        return teacherService.likeSelect(TeacherEntity);
    }


    /**
     * 添加
     *
     * @return
     */
    @ApiOperation(value = "添加")
    @LoginRequired
    @RecordLog
    @PostMapping(value = "/add")
    public void add(@RequestBody TeacherEntity entity) {
        teacherService.add(entity);
    }


    /**
     * 导出excel
     *
     * @return
     */
    @ApiOperation(value = "导出excel")
    @LoginRequired
    @RecordLog
    @GetMapping("/exportExcel")
    public void exportExcel(TeacherEntity entity, HttpServletResponse response) {
        teacherService.exportExcel(entity, response);
    }


    /**
     * 教师统计
     *
     * @return
     */
    @ApiOperation(value = "教师统计")
    /* @LoginRequired*/
    @RecordLog
    @PostMapping(value = "/teacherCount")
    public ResponseResult teacherCount() {
        return teacherService.count();
    }

    @ApiOperation(value = "教师统计")
    @LoginRequired
    @RecordLog
    @PostMapping(value = "/getTeacher")
    public List<TeacherEntity> getTeacher(){
     return teacherService.select();
    }











/*
    */
/**
     * 获取教师信息
     *
     * @return
     *//*

    @ApiOperation(value = "获取教师信息", notes = "获取教师信息")
    */
/* @LoginRequired*//*

    @RecordLog
    @PostMapping(value = "/getTeacher")
    public List<TeacherEntity> getTeacher() {

        return teacherService.select(null);
    }
*/









    /*

     */
/**
 * 教师统计
 *
 * @return
 *//*

    @ApiOperation(value = "teacherCount")
  */
    /*  @LoginRequired*//*

    @RecordLog
    @PostMapping(value = "/teacherCount")
    public ResponseResult teacherCount() {
       return teacherService.teacherCount();
    }
*/


}
